Skip to content

feat: Add REST API endpoints for React migration (Phase 1)#88

Open
devin-ai-integration[bot] wants to merge 1 commit intoDevOpsfrom
devin/1768932550-backend-api-conversion
Open

feat: Add REST API endpoints for React migration (Phase 1)#88
devin-ai-integration[bot] wants to merge 1 commit intoDevOpsfrom
devin/1768932550-backend-api-conversion

Conversation

@devin-ai-integration
Copy link

Summary

This PR implements Phase 1 of the backend API conversion to support a future React frontend migration. The changes add REST API endpoints that return JSON responses alongside the existing Thymeleaf-based server-side rendering, allowing both to coexist.

Key changes include adding JWT-based authentication for API endpoints under /api/**, creating DTO classes for API request/response communication, and implementing new REST controllers for banking operations (deposit, withdraw, transfer) and authentication (login, register).

The existing BankController and Thymeleaf templates remain intact. The security configuration now uses two separate filter chains: one for API endpoints (stateless JWT) and one for web endpoints (form-based sessions).

Review & Testing Checklist for Human

  • Security: JWT secret key - JwtUtil.java uses a hardcoded default secret. Verify that jwt.secret will be configured via environment/properties in production deployments.
  • Input validation missing - DTO classes (DepositRequest, WithdrawRequest, TransferRequest) lack validation annotations. Consider whether negative amounts or null values could cause issues.
  • Dual security filter chain - Test that the /api/** endpoints use JWT auth while existing web routes (/login, /dashboard, etc.) still work with form-based auth.
  • Test the API endpoints manually - No automated tests were added. Recommend testing the full flow:
    1. POST /api/auth/register with {"username": "test", "password": "test123"}
    2. POST /api/auth/login with same credentials, capture the JWT token
    3. GET /api/account with Authorization: Bearer <token> header
    4. POST /api/deposit with {"amount": 100} and the auth header
    5. Verify the existing Thymeleaf login/dashboard still works

Notes

- Add JWT dependencies to pom.xml
- Create DTO classes for API request/response communication
- Create JwtUtil and JwtAuthenticationFilter for JWT authentication
- Create BankApiController with REST endpoints for account operations
- Create AuthController with login/register endpoints
- Update SecurityConfig to support both JWT and form-based authentication

Co-Authored-By: Eashan Sinha <eashan.sinha@codeium.com>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants